<%--
  Author: Albert
--%>
<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>添加员工</title>
</head>
<body>

<%-- 从地址栏提取错误信息，打印到页面上 --%>
<c:if test="${param.msg}">
    <div style="color: orangered; text-align: center; margin-bottom: 10px">
            ${param.msg}
    </div>
</c:if>
<div class="container">
    <%-- POST请求调用后端接口 --%>
    <form action="${pageContext.request.contextPath}/emp/save" method="post">
        <table cellpadding="0" cellspacing="0" border="0" class="form_table">
            <tr>
                <td valign="middle" align="right">
                    name:
                </td>
                <td valign="middle" align="left">
                    <input type="text" class="input_text" name="name"/>
                </td>
            </tr>
            <tr>
                <td valign="middle" align="right">
                    salary:
                </td>
                <td valign="middle" align="left">
                    <input type="text" class="input_text" name="salary"/>
                </td>
            </tr>
            <tr>
                <td valign="middle" align="right">
                    age:
                </td>
                <td valign="middle" align="left">
                    <input type="text" class="input_text" name="age"/>
                </td>
            </tr>
        </table>
        <p>
            <input type="submit" class="button" value="点击添加"/>
        </p>
    </form>
</div>

<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        background-color: #f4f4f9;
    }

    .container {
        background-color: #fff;
        padding: 20px;
        border-radius: 8px;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        width: 400px;
    }

    .form_table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .form_table td {
        padding: 10px 0;
    }

    .form_table td[align="right"] {
        padding-right: 10px;
        white-space: nowrap;
    }

    .form_table td[align="left"] {
        padding-left: 10px;
    }

    .input_text {
        width: calc(100% - 20px);
        padding: 8px;
        border: 1px solid #ccc;
        border-radius: 4px;
    }

    .button {
        padding: 10px 20px;
        background-color: #007bff;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        width: 100%;
    }

    .button:hover {
        background-color: #0056b3;
    }
</style>

</body>
</html>